package cn.online.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * Teacher entity.
 * 
 * @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "teacher", catalog = "online")
public class Teacher implements java.io.Serializable {

	// Fields

	private Integer tid;
	private Course course;
	private String tname;
	private String tpassword;
	private String trealname;
	private String tmail;

	// Constructors

	/** default constructor */
	public Teacher() {
	}

	/** minimal constructor */
	public Teacher(Course course, String tname, String tpassword,
			String trealname) {
		this.course = course;
		this.tname = tname;
		this.tpassword = tpassword;
		this.trealname = trealname;
	}

	/** full constructor */
	public Teacher(Course course, String tname, String tpassword,
			String trealname, String tmail) {
		this.course = course;
		this.tname = tname;
		this.tpassword = tpassword;
		this.trealname = trealname;
		this.tmail = tmail;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "t_id", unique = true, nullable = false)
	public Integer getTid() {
		return this.tid;
	}

	public void setTid(Integer tid) {
		this.tid = tid;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "c_id")
	public Course getCourse() {
		return this.course;
	}

	public void setCourse(Course course) {
		this.course = course;
	}

	@Column(name = "t_name", nullable = false, length = 20)
	public String getTname() {
		return this.tname;
	}

	public void setTname(String tname) {
		this.tname = tname;
	}

	@Column(name = "t_password", nullable = false, length = 20)
	public String getTpassword() {
		return this.tpassword;
	}

	public void setTpassword(String tpassword) {
		this.tpassword = tpassword;
	}

	@Column(name = "t_realname", nullable = false, length = 20)
	public String getTrealname() {
		return this.trealname;
	}

	public void setTrealname(String trealname) {
		this.trealname = trealname;
	}

	@Column(name = "t_mail", length = 100)
	public String getTmail() {
		return this.tmail;
	}

	public void setTmail(String tmail) {
		this.tmail = tmail;
	}

}